Pain dummy

Pain :: load dataset

mount_dir = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel';
con_list = dir(fullfile(mount_dir, '*/con_0024.nii'));
spm('Defaults','fMRI')
con_fldr = {con_list.folder}; fname = {con_list.name};
con_files = strcat(con_fldr,'/', fname)';
con_data_obj = fmri_data(con_files);
Using default mask: /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii Direct calls to spm_defauts are deprecated. Please use spm('Defaults',modality) or spm_get_defaults instead.
sampleto = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0024.nii'
loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 24360228 bytes Loading image number: 61 Elapsed time is 166.079301 seconds. Image names entered, but fullpath attribute is empty. Getting path info. Number of unique values in dataset: 5975338 Bit rate: 22.51 bits
contrast_name = {'cue_P', 'cue_V', 'cue_C', 'cue_G',...
'cueXcue_P', 'cueXcue_V', 'cueXcue_C', 'cueXcue_G',...
'stim_P', 'stim_V', 'stim_C', 'stim_G',...
'stimXcue_P', 'stimXcue_V', 'stimXcue_C', 'stimXcue_G',...
'motor', ...
'simple_cue_P', 'simple_cue_V', 'simple_cue_C',...
'simple_cueXcue_P', 'simple_cueXcue_V', 'simple_cueXcue_C', ...
'simple_stim_P', 'simple_stim_V', 'simple_stim_C',...
'simple_stimXcue_P', 'simple_stimXcue_V', 'simple_stimXcue_C'};

Pain :: check data coverage

m = mean(con_data_obj);
m.dat = sum(~isnan(con_data_obj.dat) & con_data_obj.dat ~= 0, 2);
orthviews(m, 'trans') % display
SPM12: spm_check_registration (v7759) 02:51:22 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
ans = 1×1 cell array
{1×1 region}

Pain :: Plot diagnostics, before l2norm

drawnow; snapnow
[wh_outlier_uncorr, wh_outlier_corr] = plot(con_data_obj)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values | 0 images Retained 10 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 27.87% Expected 3.05 outside 95% ellipsoid, found 14 Potential outliers based on mahalanobis distance: Bonferroni corrected: 7 images Cases 10 26 28 30 43 46 57 Uncorrected: 14 images Cases 7 10 18 26 28 30 35 37 42 43 46 47 48 57 Retained 17 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 50.82% Expected 3.05 outside 95% ellipsoid, found 0 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 0 images Cases Mahalanobis (cov and corr, q<0.05 corrected): 7 images Outlier_count Percentage _____________ __________ global_mean 2 3.2787 global_mean_to_variance 2 3.2787 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 2 3.2787 mahal_cov_uncor 14 22.951 mahal_cov_corrected 7 11.475 mahal_corr_uncor 0 0 mahal_corr_corrected 0 0 Overall_uncorrected 14 22.951 Overall_corrected 7 11.475
SPM12: spm_check_registration (v7759) 02:52:01 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 (all) /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
wh_outlier_uncorr = 61×1 logical array
0 0 0 0 0 0 1 0 0 1
wh_outlier_corr = 61×1 logical array
0 0 0 0 0 0 0 0 0 1

Pain :: run robfit

set(gcf,'Visible','on')
figure ('Visible', 'on');
drawnow, snapnow;

Pain :: remove outliers based on plot

con = con_data_obj;
disp(strcat("current length is ", num2str(size(con_data_obj.dat,2))))
current length is 61
%for s = 1:length(wh_outlier_corr)
%disp(strcat("-------subject", num2str(s), "------"))
con.dat = con_data_obj.dat(:,~wh_outlier_corr);
con.image_names = con_data_obj.image_names(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×54 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [54×12 char] fullpath: [61×109 char] files_exist: [61×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0024.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.fullpath = con_data_obj.fullpath(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×54 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [54×12 char] fullpath: [54×109 char] files_exist: [61×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0024.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.files_exist = con_data_obj.files_exist(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×54 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [54×12 char] fullpath: [54×109 char] files_exist: [54×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0024.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
%end
disp(strcat("after removing ", num2str(sum(wh_outlier_corr)), " participants, size is now ",num2str(size(con.dat,2))))
after removing 7 participants, size is now 54

Pain :: plot diagnostics, after l2norm

imgs2 = con.rescale('l2norm_images');

Pain :: ttest

t = ttest(imgs2);
One-sample t-test Calculating t-statistics and p-values
orthviews(t)
SPM12: spm_check_registration (v7759) 02:52:07 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×1 struct}
drawnow, snapnow;
fdr_t = threshold(t, .05, 'fdr');
Image 1 FDR q < 0.050 threshold is 0.006606 Image 1 104 contig. clusters, sizes 1 to 10129 Positive effect: 13144 voxels, min p-value: 0.00000000 Negative effect: 47 voxels, min p-value: 0.00025868
orthviews(fdr_t)
SPM12: spm_check_registration (v7759) 02:52:08 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×104 struct}
drawnow, snapnow;
create_figure('montage'); axis off
montage(fdr_t)
Setting up fmridisplay objects
sagittal montage: 244 voxels displayed, 12947 not displayed on these slices
sagittal montage: 218 voxels displayed, 12973 not displayed on these slices
sagittal montage: 179 voxels displayed, 13012 not displayed on these slices
axial montage: 2451 voxels displayed, 10740 not displayed on these slices
axial montage: 2690 voxels displayed, 10501 not displayed on these slices
ans =
fmridisplay with properties: overlay: '/Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img' SPACE: [1×1 struct] activation_maps: {[1×1 struct]} montage: {[1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct]} surface: {} orthviews: {} history: {} history_descrip: [] additional_info: ''
drawnow, snapnow;

Vicarious dummy

clear all

Vicarious :: load dataset

mount_dir = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel';
con_list = dir(fullfile(mount_dir, '*/con_0025.nii'));
spm('Defaults','fMRI')
con_fldr = {con_list.folder}; fname = {con_list.name};
con_files = strcat(con_fldr,'/', fname)';
con_data_obj = fmri_data(con_files);
Using default mask: /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii Direct calls to spm_defauts are deprecated. Please use spm('Defaults',modality) or spm_get_defaults instead.
sampleto = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0025.nii'
loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 24360228 bytes Loading image number: 61 Elapsed time is 166.904610 seconds. Image names entered, but fullpath attribute is empty. Getting path info. Number of unique values in dataset: 5954046 Bit rate: 22.51 bits
contrast_name = {'cue_P', 'cue_V', 'cue_C', 'cue_G',...
'cueXcue_P', 'cueXcue_V', 'cueXcue_C', 'cueXcue_G',...
'stim_P', 'stim_V', 'stim_C', 'stim_G',...
'stimXcue_P', 'stimXcue_V', 'stimXcue_C', 'stimXcue_G',...
'motor', ...
'simple_cue_P', 'simple_cue_V', 'simple_cue_C',...
'simple_cueXcue_P', 'simple_cueXcue_V', 'simple_cueXcue_C', ...
'simple_stim_P', 'simple_stim_V', 'simple_stim_C',...
'simple_stimXcue_P', 'simple_stimXcue_V', 'simple_stimXcue_C'};

Vicarious :: check data coverage

m = mean(con_data_obj);
m.dat = sum(~isnan(con_data_obj.dat) & con_data_obj.dat ~= 0, 2);
orthviews(m, 'trans') % display
SPM12: spm_check_registration (v7759) 02:55:28 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
ans = 1×1 cell array
{1×1 region}

Vicarious :: Plot diagnostics, before l2norm

drawnow; snapnow
[wh_outlier_uncorr, wh_outlier_corr] = plot(con_data_obj)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values | 0 images Retained 10 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 21.31% Expected 3.05 outside 95% ellipsoid, found 9 Potential outliers based on mahalanobis distance: Bonferroni corrected: 9 images Cases 10 15 21 23 28 30 31 48 57 Uncorrected: 9 images Cases 10 15 21 23 28 30 31 48 57 Retained 17 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 54.10% Expected 3.05 outside 95% ellipsoid, found 0 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 0 images Cases Mahalanobis (cov and corr, q<0.05 corrected): 9 images Outlier_count Percentage _____________ __________ global_mean 2 3.2787 global_mean_to_variance 2 3.2787 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 1 1.6393 mahal_cov_uncor 9 14.754 mahal_cov_corrected 9 14.754 mahal_corr_uncor 0 0 mahal_corr_corrected 0 0 Overall_uncorrected 9 14.754 Overall_corrected 9 14.754
SPM12: spm_check_registration (v7759) 02:56:06 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 (all) /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
wh_outlier_uncorr = 61×1 logical array
0 0 0 0 0 0 0 0 0 1
wh_outlier_corr = 61×1 logical array
0 0 0 0 0 0 0 0 0 1

Vicarious :: run robfit

set(gcf,'Visible','on')
figure ('Visible', 'on');
drawnow, snapnow;

Vicarious :: remove outliers based on plot

con = con_data_obj;
disp(strcat("current length is ", num2str(size(con_data_obj.dat,2))))
current length is 61
%for s = 1:length(wh_outlier_corr)
% disp(strcat("-------subject", num2str(s), "------"))
con.dat = con_data_obj.dat(:,~wh_outlier_corr);
con.image_names = con_data_obj.image_names(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×52 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [52×12 char] fullpath: [61×109 char] files_exist: [61×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0025.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.fullpath = con_data_obj.fullpath(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×52 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [52×12 char] fullpath: [52×109 char] files_exist: [61×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0025.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.files_exist = con_data_obj.files_exist(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×52 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [52×12 char] fullpath: [52×109 char] files_exist: [52×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0025.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
%end
disp(strcat("after removing ", num2str(sum(wh_outlier_corr)), " participants, size is now ",num2str(size(con.dat,2))))
after removing 9 participants, size is now 52

Vicarious :: plot diagnostics, after l2norm

imgs2 = con.rescale('l2norm_images');

Vicarious :: ttest

t = ttest(imgs2);
One-sample t-test Calculating t-statistics and p-values
orthviews(t)
SPM12: spm_check_registration (v7759) 02:56:11 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×1 struct}
drawnow, snapnow;
fdr_t = threshold(t, .05, 'fdr');
Image 1 FDR q < 0.050 threshold is 0.018280 Image 1 55 contig. clusters, sizes 1 to 36148 Positive effect: 36459 voxels, min p-value: 0.00000000 Negative effect: 40 voxels, min p-value: 0.00121522
orthviews(fdr_t)
SPM12: spm_check_registration (v7759) 02:56:13 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×55 struct}
drawnow, snapnow;
create_figure('montage'); axis off
montage(fdr_t)
Setting up fmridisplay objects
sagittal montage: 775 voxels displayed, 35724 not displayed on these slices
sagittal montage: 793 voxels displayed, 35706 not displayed on these slices
sagittal montage: 705 voxels displayed, 35794 not displayed on these slices
axial montage: 6838 voxels displayed, 29661 not displayed on these slices
axial montage: 7392 voxels displayed, 29107 not displayed on these slices
ans =
fmridisplay with properties: overlay: '/Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img' SPACE: [1×1 struct] activation_maps: {[1×1 struct]} montage: {[1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct]} surface: {} orthviews: {} history: {} history_descrip: [] additional_info: ''
drawnow, snapnow;

Cognitive dummy

Cognitive :: load dataset

mount_dir = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel';
con_list = dir(fullfile(mount_dir, '*/con_0026.nii'));
spm('Defaults','fMRI')
con_fldr = {con_list.folder}; fname = {con_list.name};
con_files = strcat(con_fldr,'/', fname)';
con_data_obj = fmri_data(con_files);
Using default mask: /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii
sampleto = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0026.nii'
loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 24360228 bytes Loading image number: 61 Elapsed time is 184.082598 seconds. Image names entered, but fullpath attribute is empty. Getting path info. Number of unique values in dataset: 5943010 Bit rate: 22.50 bits
contrast_name = {'cue_P', 'cue_V', 'cue_C', 'cue_G',...
'cueXcue_P', 'cueXcue_V', 'cueXcue_C', 'cueXcue_G',...
'stim_P', 'stim_V', 'stim_C', 'stim_G',...
'stimXcue_P', 'stimXcue_V', 'stimXcue_C', 'stimXcue_G',...
'motor', ...
'simple_cue_P', 'simple_cue_V', 'simple_cue_C',...
'simple_cueXcue_P', 'simple_cueXcue_V', 'simple_cueXcue_C', ...
'simple_stim_P', 'simple_stim_V', 'simple_stim_C',...
'simple_stimXcue_P', 'simple_stimXcue_V', 'simple_stimXcue_C'};

Cognitive :: check data coverage

m = mean(con_data_obj);
m.dat = sum(~isnan(con_data_obj.dat) & con_data_obj.dat ~= 0, 2);
orthviews(m, 'trans') % display
SPM12: spm_check_registration (v7759) 03:00:10 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
ans = 1×1 cell array
{1×1 region}

Cognitive :: Plot diagnostics, before l2norm

drawnow; snapnow
[wh_outlier_uncorr, wh_outlier_corr] = plot(con_data_obj)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values | 0 images Retained 3 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 29.51% Expected 3.05 outside 95% ellipsoid, found 5 Potential outliers based on mahalanobis distance: Bonferroni corrected: 1 images Cases 44 Uncorrected: 5 images Cases 7 44 50 53 57 Retained 13 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 50.82% Expected 3.05 outside 95% ellipsoid, found 0 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 0 images Cases Mahalanobis (cov and corr, q<0.05 corrected): 1 images Outlier_count Percentage _____________ __________ global_mean 3 4.918 global_mean_to_variance 2 3.2787 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 1 1.6393 mahal_cov_uncor 5 8.1967 mahal_cov_corrected 1 1.6393 mahal_corr_uncor 0 0 mahal_corr_corrected 0 0 Overall_uncorrected 5 8.1967 Overall_corrected 1 1.6393
SPM12: spm_check_registration (v7759) 03:00:37 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 (all) /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
wh_outlier_uncorr = 61×1 logical array
0 0 0 0 0 0 1 0 0 0
wh_outlier_corr = 61×1 logical array
0 0 0 0 0 0 0 0 0 0

Cognitive :: run robfit

set(gcf,'Visible','on')
figure ('Visible', 'on');
drawnow, snapnow;

Cognitive :: remove outliers based on plot

con = con_data_obj;
disp(strcat("current length is ", num2str(size(con_data_obj.dat,2))))
current length is 61
%for s = 1:length(wh_outlier_corr)
% disp(strcat("-------subject", num2str(s), "------"))
con.dat = con_data_obj.dat(:,~wh_outlier_corr);
con.image_names = con_data_obj.image_names(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×60 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [60×12 char] fullpath: [61×109 char] files_exist: [61×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0026.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.fullpath = con_data_obj.fullpath(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×60 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [60×12 char] fullpath: [60×109 char] files_exist: [61×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0026.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.files_exist = con_data_obj.files_exist(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×60 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [60×12 char] fullpath: [60×109 char] files_exist: [60×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0026.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
%end
disp(strcat("after removing ", num2str(sum(wh_outlier_corr)), " participants, size is now ",num2str(size(con.dat,2))))
after removing 1 participants, size is now 60

Cognitive:: plot diagnostics, after l2norm

imgs2 = con.rescale('l2norm_images');

Cognitive :: ttest

t = ttest(imgs2);
One-sample t-test Calculating t-statistics and p-values
orthviews(t)
SPM12: spm_check_registration (v7759) 03:00:41 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×1 struct}
drawnow, snapnow;
fdr_t = threshold(t, .05, 'fdr');
Image 1 FDR q < 0.050 threshold is 0.015786 Image 1 72 contig. clusters, sizes 1 to 30444 Positive effect: 31494 voxels, min p-value: 0.00000000 Negative effect: 29 voxels, min p-value: 0.00047994
orthviews(fdr_t)
SPM12: spm_check_registration (v7759) 03:00:42 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×72 struct}
drawnow, snapnow;
create_figure('montage'); axis off
montage(fdr_t)
Setting up fmridisplay objects
sagittal montage: 570 voxels displayed, 30953 not displayed on these slices
sagittal montage: 697 voxels displayed, 30826 not displayed on these slices
sagittal montage: 483 voxels displayed, 31040 not displayed on these slices
axial montage: 5275 voxels displayed, 26248 not displayed on these slices
axial montage: 6014 voxels displayed, 25509 not displayed on these slices
ans =
fmridisplay with properties: overlay: '/Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img' SPACE: [1×1 struct] activation_maps: {[1×1 struct]} montage: {[1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct]} surface: {} orthviews: {} history: {} history_descrip: [] additional_info: ''
drawnow, snapnow;